#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from django.urls import path, re_path
from rest_framework import routers
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)

from users import views

urlpatterns = [
    re_path("^usernames/(?P<username>\w{5,20})/count/$", views.UserCountView.as_view()),
    re_path(
        "^mobiles/(?P<mobile>1[3-9]\d{9})/count/$", views.MobileCountView.as_view()
    ),
    path("register/", views.UserRegisterView.as_view()),
    path("api/token/", TokenObtainPairView.as_view(), name="token_obtain_pair"),
    path("api/token/refresh/", TokenRefreshView.as_view(), name="token_refresh"),
    path("login/", views.LoginView.as_view()),
    path("detail/", views.UserDetailView.as_view()),
    path("email/verify/", views.EmailVerifyView.as_view()),
]

router = routers.DefaultRouter()
router.register(r"addresses", views.AddressViewSet, basename="addresses")

urlpatterns += router.urls
# POST /addresses/ 新建  -> create
# PUT /addresses/<pk>/ 修改  -> update
# GET /addresses/  查询  -> list
# DELETE /addresses/<pk>/  删除 -> destroy
# PUT /addresses/<pk>/status/ 设置默认 -> status
# PUT /addresses/<pk>/title/  设置标题 -> title
